package web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.ui.ModelMap;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

import beans.User;

import dao.UserDAO;

import web.LoggedUser;

public class AdminController extends MultiActionController{
	
	private UserDAO userDAO;

	public void setUserDAO(UserDAO userDAO) {
		this.userDAO = userDAO;
	}

	private LoggedUser loggedUser;

	public void setLoggedUser(LoggedUser loggedUser) {
		this.loggedUser = loggedUser;
	}
	
	
	public ModelAndView adminkonto(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		
		User user = loggedUser.getLoggedUser();
		ModelMap modelMap = new ModelMap();
		modelMap.addAttribute("user", user);
			return new ModelAndView("adminkonto",modelMap);
	}
	
	public ModelAndView uzytkownicy(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		User user = loggedUser.getLoggedUser();
		ModelMap modelMap = new ModelMap();
			return new ModelAndView("uzytkownicy",modelMap);
	}
	
	public ModelAndView restauracje(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		User user = loggedUser.getLoggedUser();
		ModelMap modelMap = new ModelMap();
			return new ModelAndView("restauracje",modelMap);
	}
	
	public ModelAndView adminnews(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		User user = loggedUser.getLoggedUser();
		ModelMap modelMap = new ModelMap();
			return new ModelAndView("adminnews",modelMap);
	}
	
	public ModelAndView adminlogout(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		User user = loggedUser.getLoggedUser();
		ModelMap modelMap = new ModelMap();
			return new ModelAndView("adminlogout",modelMap);
	}
	
}
